home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_actor_stickyicemonster.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  124 lines

  1. # Jones 3D Cog Script
  2. #
  3. # actor_StickyIceMonster.cog
  4. #
  5. # [PKM]    [RT]
  6. #
  7. # For the sticky ice monster only!  He'll jump off wall or ceiling when he sees Indy.
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ========================================================================================
  12.  
  13. symbols
  14.  
  15.     message        aievent
  16.     message        damaged
  17.  
  18. # ************************** TEMPLATES *************************
  19.  
  20.     sound        detachSound=fol_si_detach.wav    local
  21.  
  22.     template    tpl_Monster=ice_monster               local
  23.     template    tpl_IceShower=+ice_exp_blast_sm    local
  24.  
  25. # *********************** MISC LOCAL VARS **********************
  26.  
  27.     thing        newMonster                           local
  28.     thing        sender                               local
  29.     cog            cog_capture                           local
  30.     vector        vec_vel                               local
  31.  
  32. # ******************** MISSING LOCAL VARS :) *******************
  33.  
  34.     flex        floorDistance                    local
  35.     vector        thingPos                        local
  36.  
  37. # ************************ SUBROUTINES *************************
  38.  
  39.     flex        drop                            local
  40.  
  41. end
  42.  
  43. # ===================================================================
  44.  
  45. code
  46.  
  47. aievent:
  48.  
  49.     sender = GetSenderRef();
  50.  
  51.     if ( GetParam(0) == 0x100 )                                    #---- EVENT_MODECHANGED
  52.     {                                                                # Switched to MODE_ATTACKING?
  53.         if ( BITTEST(GetParam(1), 0x02) && !BITTEST(GetParam(2), 0x02) )
  54.         {
  55.             if ( GetAttachFlags(sender) != 0 )
  56.             {
  57.                 Sleep(0.1);
  58.                 PlaySoundThing(detachSound, sender, 1.0, 5.0, 10.0, 0x80);
  59.                 call drop;
  60.             }
  61.         }
  62.     }
  63.  
  64.     if (BITTEST(GetParam(0), 0x100e04))
  65.     {
  66.         # We've reached our movement goal, or we hit a wall, floor, or thing - explode!
  67.         newMonster = CreateThing(tpl_Monster, sender);
  68.         if ( newMonster > -1 )
  69.         {
  70.             # Give new AI time to "reach the floor" before it starts moving
  71.             AIPauseMove(newMonster, 250);
  72.  
  73.             # If "pupal" ice monster had a capture COG, pass on to the "butterfly"
  74.             cog_capture = GetThingCaptureCog(sender);
  75.             if ( cog_capture > -1 )
  76.             {
  77.                 SetThingCaptureCog(newMonster, cog_capture);
  78.             }
  79.         }
  80.  
  81.         CreateThing(tpl_IceShower, sender);
  82.         DestroyThing(sender);
  83.     }
  84.  
  85.     return;
  86.  
  87.  
  88. # -------------------------------------------------------------------
  89.  
  90. damaged:
  91.  
  92.     sender = GetSenderRef();
  93.  
  94.     if (GetSourceRef() != GetLocalPlayerThing())
  95.     {
  96.         ReturnEx(0);
  97.         return;
  98.     }
  99.  
  100.     if (GetAttachFlags(sender) != 0)
  101.     {
  102.         Sleep(0.1);
  103.         call drop;
  104.     }
  105.  
  106.     return;
  107.  
  108. # -------------------------------------------------------------------
  109.  
  110. drop:
  111.  
  112.     DetachThing(sender);
  113.     floorDistance = CheckFloorDistance(sender);
  114.     thingPos = GetThingPos(sender);
  115.     thingPos = VectorSet(VectorX(thingPos), VectorY(thingPos), VectorZ(thingPos) - floorDistance);
  116.     SetPhysicsFlags(sender, 0x2000);
  117.     AISetMovePos(sender, thingPos, 0);
  118.     AISetMoveSpeed(sender, 0.5);
  119.  
  120.     return;
  121.  
  122. end
  123.  
  124.